load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "consistenthashing",
    srcs = ["etcd.go"],
    importpath = "github.com/pachyderm/pachyderm/v2/src/internal/consistenthashing",
    visibility = ["//src:__subpackages__"],
    deps = [
        "//src/internal/backoff",
        "//src/internal/collection",
        "//src/internal/dlock",
        "//src/internal/errors",
        "//src/internal/log",
        "//src/internal/pctx",
        "//src/internal/uuid",
        "//src/internal/watch",
        "@io_etcd_go_etcd_client_v3//:client",
        "@io_etcd_go_etcd_client_v3//concurrency",
        "@org_golang_google_protobuf//types/known/wrapperspb",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "consistenthashing_test",
    size = "small",
    srcs = ["etcd_test.go"],
    embed = [":consistenthashing"],
    shard_count = 4,
    deps = [
        "//src/internal/collection",
        "//src/internal/errors",
        "//src/internal/log",
        "//src/internal/pctx",
        "//src/internal/require",
        "//src/internal/testetcd",
        "@io_etcd_go_etcd_client_v3//:client",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_zap//:zap",
    ],
)
